saga2edit manual: Disassembly

Disassembly

Saga2edit has a built in disassembler. This is intended only to be used if the code has not yet been modified. (Any modifications done within saga2edit will not cause any conflict.) This will disassemble all the assembly code in the entire game. It will also disassemble the battle scripting language code into a saga2edit-specific format that saga2edit can then reassemble. The files will be placed in a directory with the same name as the ROM file with ".saga2edit" added.

The assembly source files that saga2edit produces are designed to work with WLA DX, but you are welcome to adapt them to fit your needs.

The battle language code (disassembled to "battle.script") can be assembled by invoking saga2edit from the command line like java -jar saga2edit.jar --assemble INPUT_FILE OUTPUT_FILE. This will produce an assembly language file that can be assembled with WLA and linked together with the other object files (so that the battle scripting language can see symbols defined in assembly and vice versa).

Here is an example of a batch script that will reassemble the game into "a.gb" on Windows. (You may have to deal with paths for WLA, Java, and saga2edit yourself.)

@echo off
MD build
echo [objects] > build\linkfile
FOR %%G IN (*.s) DO (
  wla-gb -o build\%%G.o %%G
  echo build\%%G.o >> build\linkfile
)
java -jar saga2edit.jar --assemble battle.script build\battle.script.s
wla-gb -o build\battle.script.s.o build\battle.script.s
echo build\battle.script.s.o >> build\linkfile
wlalink build\linkfile a.gb